package com.suiyun.EventBusDemo.async.controller;

import com.suiyun.EventBusDemo.async.event.DemoAsyncEvent;
import com.suiyun.EventBusDemo.async.handler.AsyncEventHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ww
 * @date 2020/10/29 下午2:27
 */
@Slf4j
@RestController
public class AysncEventBusController {

    @Autowired
    private AsyncEventHandler asyncEventHandler;

    @GetMapping("/asyncEventBus")
    public String asyncEventBus(){
        DemoAsyncEvent demoEvent = new DemoAsyncEvent();
        demoEvent.setName("eventBus");

        asyncEventHandler.asyncEventPost(demoEvent);
        log.info("-----> 发送异步");
        return "success";
    }
}
